<?php
/**
 * Created by PhpStorm.
 * User: Inhere
 * Date: 2015/3/11
 * Use : ...
 * File: AbstractCommand.php
 */

namespace ulue\core\db\base\command;


use ulue\core\db\base\AbstractDbDriver;
use ulue\core\abstracts\AbstractCore;

abstract class AbstractCommand extends AbstractCore
{
    /**
     * @var AbstractDbDriver
     */
	protected $db;

    /**
     * Property name.
     * @var  string
     */
    protected $name = null;

    public function qn($name)
    {
        return $this->db->quoteName($name);
    }

    public function q($value)
    {
        return $this->db->quote($value);
    }

    /**
     * Method to set property db
     * @param AbstractDbDriver $db
     * @return  static  Return self to support chaining.
     */
    public function setDriver(AbstractDbDriver $db)
    {
        $this->db = $db;

        return $this;
    }

    /**
     * Method to get property Db
     */
    public function getDriver()
    {
        return $this->db;
    }


    /**
     * Method to get property name
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Method to set property table
     * @param   string $name
     * @return  static  Return self to support chaining.
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

}// end class AbstractCommand